package com.shop2cn.iapi.agentproducts.testcase;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.CatalogPropDto;
import com.shop2cn.iapi.agentproducts.parameter.LoadPicsBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductCatalogListDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductListDto;
import com.shop2cn.iapi.agentproducts.parameter.SubCatalogDto;
import com.shop2cn.iapi.agentproducts.service.AddAgentProductCall;
import com.shop2cn.iapi.agentproducts.service.AddAgentProductCallV2;
import com.shop2cn.iapi.agentproducts.service.LoadPicsCall;
import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateCollectionGoodsAddressBean;
import com.ymatou.iapi.godfreightmgr.parameter.CreateFreightTemplateBean;
import com.ymatou.iapi.godmch.parameter.CreateCodeBean;
import com.ymatou.iapi.godmch.parameter.SetMarkupConfigBean;
import com.ymatou.iapi.godmch.parameter.createDepotBean;
import com.ymatou.iapi.godmch.parameter.createmchBean;
import com.ymatou.iapi.godmch.parameter.setConditionMarkupConfigBean;
import com.ymatou.iapi.godmch.service.CreateCodeCall;
import com.ymatou.iapi.godmch.service.SetMarkupConfigCall;
import com.ymatou.iapi.prodstock.parameter.AgentProductPo;
import com.ymatou.mq.admin.parameter.MessageListBean;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.business.service.AgentProductCallService;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.GodfreightmgrService;
import com.ymttest.business.service.MqQueryCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.model.godmch.mch_depot_info;
import com.ymttest.database.model.stockmgr.agentinventory;
import com.ymttest.database.model.stockmgr.agentinventoryExample;
import com.ymttest.database.model.stockmgr.agentinventorysku;
import com.ymttest.database.model.stockmgr.agentinventoryskuExample;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.database.sqlwapper.stockmgr.agentinventoryWapper;
import com.ymttest.database.sqlwapper.stockmgr.agentinventoryskuWapper;
import com.ymttest.utils.AgentUsers;
import com.ymttest.utils.TestDataManager;

/**
 * 代理商品发布接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_AddAgentProduct {
	private static AddAgentProductBean addagentproductBean;
	private static AddAgentProductCall addagentproductCall;
	// 渠道商
	private static int sellerId = AgentUsers.rootUserId;
	private static String sellerName = "NickautoTest";
	// 代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";
	// 免税店
	private static int userId = AgentUsers.vipRootUserId;
	private static String userName = "韩国免税店";

	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("代理商品发布接口");
	}

	@Before
	public void caseUp() {
		addagentproductBean = new AddAgentProductBean();
		addagentproductCall = new AddAgentProductCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(addagentproductCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public void verifyMongoCurMq(String pid) throws IOException, InterruptedException {
		Thread.sleep(1000);
		MessageListBean MessageListBean2 = MqQueryCallService.initAgentMongoCrud(pid);
		List<Map> joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
		Logger.debug(joa2);
		String actionType = "AddAgentProduct";
		String appId = "agentproducts.iapi.ymatou.com";
		boolean hasAddAgentProduct=false;
		for (int i = 0; i < joa2.size(); i++) {
			if (joa2.get(i).get("ActionType").toString().equals(actionType)) {
				Logger.verifyEquals(actionType, joa2.get(i).get("ActionType"), "验证ActionType");
				Logger.verifyEquals(pid, joa2.get(i).get("ProductId"), "验证ProductId");
				Logger.verifyEquals(appId, joa2.get(i).get("AppId"), "验证AppId");
				hasAddAgentProduct = true;
			}
			Logger.verifyEquals(true, hasAddAgentProduct, "发送指令");
		}
	}
	/**
	 * 验证是否发送消息-同步建议零售价
	 * @param pid
	 * @throws IOException
	 * @throws InterruptedException
	 */
	public void verifyModifySingleAgent(String pid) throws IOException, InterruptedException {
		Thread.sleep(1000);
		MessageListBean MessageListBean2 = MqQueryCallService.initAgentMongoCrud(pid);
		List<Map> joa2 = MqQueryCallService.GetMqMessage(MessageListBean2);
		Logger.debug(joa2);
		String actionType = "ModifySingleAgentProductSellPrice";
		String appId = "agentproducts.iapi.ymatou.com";
		boolean hasModifySingleAgentProductSellPrice=false;
		for (int i = 0; i < joa2.size(); i++) {
			if (joa2.get(i).get("ActionType").toString().equals(actionType)) {
				Logger.verifyEquals(actionType, joa2.get(i).get("ActionType"), "验证ActionType");
				Logger.verifyEquals(pid, joa2.get(i).get("ProductId"), "验证ProductId");
				Logger.verifyEquals(appId, joa2.get(i).get("AppId"), "验证AppId");
				hasModifySingleAgentProductSellPrice = true;
			}
			Logger.verifyEquals(true, hasModifySingleAgentProductSellPrice, "发送指令");
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_01() {
		Logger.start(true, "渠道商发布商品，无代理价，发布单规格商品，发布成功");
		try {
			agentinventoryExample inventoryExample = new agentinventoryExample();
			agentinventoryWapper inventory = new agentinventoryWapper();

			agentinventoryskuExample skuExample = new agentinventoryskuExample();
			agentinventoryskuWapper sku = new agentinventoryskuWapper();
			Logger.comment("################入库前的数量################");
			inventoryExample.createCriteria().andSellerIdEqualTo(userId);
			List<agentinventory> inventorys1 = inventory.selectByExample(inventoryExample);
			
			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			// 删除后规格列表
			addAgentProductBean.getCatalogList().remove(0);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			// 验证数据库
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

			// 验证 会调用prodstockmgr生成出入库单
			Logger.comment("################入库后的数量################");
			inventoryExample.createCriteria().andSellerIdEqualTo(userId);
			List<agentinventory> inventorys2 = inventory.selectByExample(inventoryExample);

			skuExample.createCriteria().andProductIdEqualTo(productId);
			List<agentinventorysku> skus = sku.selectByExample(skuExample);

			Logger.verifyEquals(1, inventorys2.size() - inventorys1.size(), "验证新增入库单1条");
			Logger.verifyEquals(true, skus.size() > 0, "验证新增入库单明细");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_0201() {
		Logger.start(true, "渠道商发布商品，在买家端店铺首页中不可见，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setInvisible(false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_02() {
		Logger.start(true, "渠道商发布商品，无代理价，发布多规格商品，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_020() {
		Logger.start(true, "渠道商发布商品，开启代理权限，单规格设置代理价，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_03() {
		Logger.start(true, "渠道商发布商品，开启代理权限，多规格设置代理价，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(sellerId,
					sellerName, 2, true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_0301() {// setAgentPrice字段无意义
		Logger.start(true, "渠道商发布商品，关闭代理权限，多规格设置代理价，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(sellerId,
					sellerName, 2, true);
			addAgentProductBean.setSetAgentPrice(false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_04() {
		Logger.start(true, "不是渠道商发布商品，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(agentUserId1,
					agentUserName1, false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("非渠道商不能发布商品", addagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_05() {
		Logger.start(true, "渠道商发布商品标题超过500字数，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String title = "1";
			for (int i = 0; i < 501; i++) {
				title = title + 1;
			}
			
			addAgentProductBean.setTitle(title);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
		
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_06() {
		Logger.start(true, "渠道商发布商品，商品图片小于1张，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setPics(null);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_07() {
		Logger.start(true, "渠道商发布商品，商品图片大于8张，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			List<String> picList = new ArrayList<>();
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_300_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_500_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_600_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_700_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_800_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_900_401.jpg");
			Logger.debug("hsqdi:" + picList.size());
			// 商品图片
			
			addAgentProductBean.setPics(picList);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_AddAgentProduct_10() {
		Logger.start(true, "渠道商发布商品，开启代理权限，代理价未设置，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().forEach(p -> {
				p.setAgentPriceList(null);
			});
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证code");
			Logger.verifyEquals("代理价未设置", addagentproductCall.getString("message"), "验证message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_11() {
		Logger.start(true, "渠道商发布商品，没有选择物流方式，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setCatalogStatus(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_12() {
		Logger.start(true, "渠道商发布商品，选择海外物流，没有选择身份信息，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setCatalogStatus(100);
			addAgentProductBean.setCardInfo(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_14() {
		Logger.start(true, "渠道商保存自采商品，信息完善，保存成功,商品为下架状态");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setSaleType(2);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_23() {
		Logger.start(true, "渠道商保存自采商品，多规格直销价都没填，保存成功,商品为下架信息未完善状态");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(0d);
			addAgentProductBean.getCatalogList().get(1).setDirectPrice(0d);
			addAgentProductBean.setSaleType(2);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(-1, agentProductPo.getInfoProgress(), "验证InfoProgress");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_24() {
		Logger.start(true, "渠道商保存自采商品，多规格一个直销价没填，保存成功,商品为下架信息未完善状态");
		try {
			addagentproductBean = AddAgentProductCallService.initAddAgentProduct(sellerId, sellerName, false);
			// addagentproductBean.setSaleType(1);
			addagentproductBean.getCatalogList().get(0).setDirectPrice(null);
			;
			addagentproductCall.setData(addagentproductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(1000);
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(0, agentProductPo.getInfoProgress(), "查询商品状态");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	// 库存没填不会变成未完善库存可以为0 只有价格为0才判断为未完善-by文强华 20190718
	public void Tc_AddAgentProduct_31() {
		Logger.start(true, "渠道商保存自采商品，多规格库存都没填，保存成功,商品为下架信息未完善状态");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			addAgentProductBean.getCatalogList().get(1).setStock(0);
			addAgentProductBean.setSaleType(2);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(0, agentProductPo.getInfoProgress(), "验证InfoProgress");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_AddAgentProduct_32() {
		Logger.start(true, "渠道商保存自采商品，多规格库存其中一个没填，保存成功,商品为下架信息未完善状态");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			addAgentProductBean.setSaleType(2);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(0, agentProductPo.getInfoProgress(), "验证InfoProgress");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_33() {
		Logger.start(true, "渠道商保存自采商品，物流信息没填，保存成功,商品为下架信息未完善状态");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setCatalogStatus(0);
			addAgentProductBean.setSaleType(2);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(-1, agentProductPo.getInfoProgress(), "验证InfoProgress");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_16() {
		Logger.start(true, "商品没有填标题，保存失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setSaleType(2);
			addAgentProductBean.setTitle(null);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("title:商品标题不能为空", addagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_18() {
		Logger.start(true, "商品备注信息超过700个字符，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String remark = "1";
			for (int i = 0; i < 701; i++) {
				remark = remark + 1;
			}
			addAgentProductBean.setRemark(remark);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_19() {
		Logger.start(true, "渠道商发布商品，直销价小于0，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(-1d);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_1901() {
		Logger.start(true, "渠道商发布商品，规格重复，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			List<CatalogPropDto> propertyList = addAgentProductBean.getCatalogList().get(0).getPropertyList();
			addAgentProductBean.getCatalogList().get(1).setPropertyList(propertyList);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_191() {
		Logger.start(true, "渠道商发布商品，规格类型名称长度超过24个中文，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String name = "商";
			for (int i = 0; i < 24; i++) {
				name = name + "商";
			}

			addAgentProductBean.getCatalogList().get(0).getPropertyList().get(0).setName(name);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_192() {
		Logger.start(true, "渠道商发布商品，规格属相值超过24个中文，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String name = "商";
			for (int i = 0; i < 24; i++) {
				name = name + "商";
			}

			addAgentProductBean.getCatalogList().get(0).getPropertyList().get(0).setValue(name);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_1902() {
		Logger.start(true, "渠道商发布多规格商品，规格属性size不一致，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);

			addAgentProductBean.getCatalogList().get(0).getPropertyList().remove(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_1903() {
		Logger.start(true, "渠道商发布多规格商品，规格属性为空，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			
			addAgentProductBean.getCatalogList().forEach(p -> {
				p.setPropertyValue(null);
				p.setPropertyList(null);
			});
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_1904() {
		Logger.start(true, "渠道商发布多规格商品，规格value为空，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);

			addAgentProductBean.getCatalogList().forEach(p -> {
				p.getPropertyList().forEach(x -> {
					x.setValue(null);
				});
			});
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_20() {
		Logger.start(true, "渠道商保存商品，只有标题和图片，保存成功");
		try {
			addagentproductBean.setUserId(sellerId);
			addagentproductBean.setUserName(sellerName);
			addagentproductBean.setSaleType(2);
			addagentproductBean.setTitle("God神器");
			addagentproductBean.setCatalogList(null);
			List<String> picList = new ArrayList<>();
			picList.add(
					"http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401_n_w_l.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701_400_401.jpg");
			picList.add("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
			// 商品图片
			addagentproductBean.setPics(picList);
			addagentproductCall.setData(addagentproductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_21() {
		Logger.start(true, "渠道商发布商品，库存为0，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setStock(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_22() {
		Logger.start(true, "渠道商发布商品，规格信息不存在，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.setCatalogList(null);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_25() {
		Logger.start(true, "渠道商发布商品，代理类型不存在，发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentTypeId(1);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("代理类型不存在，参数错误", addagentproductCall.getString("message"), "验证message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_26() {
		Logger.start(true, "渠道商发布商品，物流方式是海外物流，选择输入身份信息，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCatalogStatus(100);
			addAgentProductBean.setCardInfo(1);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_27() {
		Logger.start(true, "渠道商发布商品，物流方式是海外物流，选择提供身份信息,发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCatalogStatus(100);
			addAgentProductBean.setCardInfo(1);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_28() {
		Logger.start(true, "渠道商发布商品，品牌不存在,发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setBrandId(1006);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_29() {
		Logger.start(true, "渠道商发布商品，类目不存在,发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCategoryId(0);
			addAgentProductBean.setThirdCategoryId(11);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_30() {
		Logger.start(true, "渠道商发布商品，类目不存在,发布失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCategoryId(0);
			addAgentProductBean.setThirdCategoryId(11);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_AddAgentProduct_34() {
		Logger.start(true, "客服发布商品，发布成功");
		try {
			int csid = 500023286;
			String name = "NickautoTest";
			AddAgentProductCallV2 addAgentProductCallV2 = new AddAgentProductCallV2();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(csid, name,
					false);
			addAgentProductCallV2.setData(addAgentProductBean);
			addAgentProductCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D76799A6A0A7DFE5EABBBFADB332C40F560517F6D23115912D2A9D66752A159D46C5EF288EA2ACD7155EE0F7923987B3F24F5");
			addAgentProductCallV2.callService();
			String productId = addAgentProductCallV2.getString("newProductId");
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, true);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_AddAgentProduct_35() {
		Logger.start(true, "客服发布商品，没有权限，发布失败");
		try {
			int csid = 500023289;
			String name = "NickautoTest";
			AddAgentProductCallV2 addAgentProductCallV2 = new AddAgentProductCallV2();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(csid, name,
					false);
			addAgentProductCallV2.setData(addAgentProductBean);
			addAgentProductCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767915F5F242E8D33853E112C14B8904A6AE559730333EF9D3573D244B59588F70E2BE7FDEE32326B219044BC1E17CF19372");
			addAgentProductCallV2.callService();
			Logger.verifyEquals("201", addAgentProductCallV2.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_36() {
		Logger.start(true, "客服发布商品，没有添加代理价的权限，发布失败");
		try {
			int csid = 500023287;
			String name = "NickautoTest";
			AddAgentProductCallV2 addAgentProductCallV2 = new AddAgentProductCallV2();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV2(csid, name,
					true);
			addAgentProductCallV2.setData(addAgentProductBean);
			addAgentProductCallV2.addHeader("ymt-pars",
					"accesstoken=C73D22F7D46D767915F5F242E8D33853E112C14B8904A6AE559730333EF9D3573D244B59588F70E2BE7FDEE32326B219044BC1E17CF19372");
			addAgentProductCallV2.callService();
			Logger.verifyEquals("201", addAgentProductCallV2.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_37() {
		Logger.start(true, "发布商品，带运费模板(按件)，发布成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 1, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_38() {
		Logger.start(true, "发布商品，带运费模板(按重)，发布成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.getCatalogList().forEach(x -> x.setWeight(5.00));
			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_39() {
		Logger.start(true, "发布商品，带运费模板(按重)，没有填重量，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
			addAgentProductBean.getCatalogList().forEach(p -> p.setWeight(0));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_40() {
		Logger.start(true, "发布商品，包邮，发布成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setFreightTemplateId(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_401() {
		Logger.start(true, "发布商品，运费模板不存在，发布成功");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setFreightTemplateId(11);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_41() {
		Logger.start(true, "发布商品，没有选择币种，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setCurrency(" ");
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_42() {
		Logger.start(true, "发布商品，选择的币种和运费模板的币种不一致，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setCurrency("USD");
			CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService
					.initCreateFreightTemplate(createmchBean.getMchId(), 2, 2);
			createFreightTemplateBean.setCurrency("CNY");
			String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
			addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_43() {
		Logger.start(true, "发布商品，选择的币种和商户自己币种不一致，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setCurrency("EUR");
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_44() {
		Logger.start(true, "发布商品，日本货币，直销价小数点后有数字，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("JPN");
			GodmchManageCallService.createmchCallForChannel(createmchBean);
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), false);
			addAgentProductBean.setCurrency("JPY");
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(1.01);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_45() {
		Logger.start(true, "发布商品，日本货币，代理价小数点后有数字，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("JPN");
			
			GodmchManageCallService.createmchCallForChannel(createmchBean);

			List<createmchBean> createmchList = GodmchManageCallService
					.InitcreatemchBeanForAgent(createmchBean.getMchId());
			createmchList.forEach(p -> {
				p.setCountry("JPN");
			});
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));

			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), true);
			addAgentProductBean.setCurrency("JPY");
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(0).setAgentPrice(1.01);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			
			
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_46() {
		Logger.start(true, "发布商品，韩国货币，不支持，发布失败");
		try {
			createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
			createmchBean.setCountry("KOR");
			GodmchManageCallService.createmchCallForChannel(createmchBean);

			List<createmchBean> createmchList = GodmchManageCallService
					.InitcreatemchBeanForAgent(createmchBean.getMchId());
			createmchList.forEach(p -> {
				p.setCountry("KOR");
			});
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService
					.initAddAgentProduct(createmchBean.getMchId(), createmchBean.getNickName(), true);
			addAgentProductBean.setCurrency("KRW");
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_47() {
		Logger.start(true, "渠道商发布商品，二级三级类目为空-允许成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.setCategoryId(null);
			addAgentProductBean.setThirdCategoryId(null);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			// 分类修改成其他，然后去验证数据库
			addAgentProductBean.setCategoryId(1369);
			addAgentProductBean.setThirdCategoryId(1370);
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_49() {
		Logger.start(true, "渠道商发布商品发布含税限购，成功");
		try {

			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			// 设置包税
			addAgentProductBean.setTariffRate(0.091);
			// 设置限购
			addAgentProductBean.getCatalogList().get(0).setLimitNum(10);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			// 验证数据库
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_50() {
		Logger.start(true, "渠道商发布商品发布包税限购，成功");
		try {

			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			// 设置限购
			addAgentProductBean.getCatalogList().get(0).setLimitNum(10);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			// 验证数据库
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_51() {
		Logger.start(true, "渠道商发布商品保税仓发货需要提供身份信息，成功");
		try {

			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean.setCatalogStatus(4);
			addAgentProductBean.setCardInfo(1);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			// 验证数据库
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_52() {
		Logger.start(true, "发布小视频");
		try {

			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			Thread.sleep(2000);
			// //验证数据库
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_53() {
		Logger.start(true, "发布小视频 url为空，失败");
		try {

			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			addAgentProductBean.getVideo().setUrl(null);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_54() {
		Logger.start(true, "发布小视频没有封面，失败");
		try {
			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			addAgentProductBean.getVideo().setPic(null);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_55() {
		Logger.start(true, "发布小视频视频链接错误，失败");
		try {
			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					false);
			addAgentProductBean = AddAgentProductCallService.initVideo(addAgentProductBean);
			addAgentProductBean.getVideo().setUrl("1313113123");
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_56() {
		Logger.start(true, "代理价比直销价还要高");
		try {
			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					true);
			double price = 500;
			addAgentProductBean.getCatalogList().forEach(a -> {
				a.setDirectPrice(price);// 直销价500
				a.getAgentPriceList().forEach(b -> {
					b.setAgentPrice(price + 1);// 代理价501
				});
			});
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("代理价不能高于直销价高", addagentproductCall.getString("message"), "验证Code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_57() {
		Logger.start(true, "代理价与直销价一样高");
		try {
			// 初始化一个商品bean
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, userName,
					true);
			double price = 500;
			addAgentProductBean.getCatalogList().forEach(a -> {
				a.setDirectPrice(price);// 直销价500
				a.getAgentPriceList().forEach(b -> {
					b.setAgentPrice(price);// 代理价501
				});
			});
			
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	public void Tc_AddAgentProduct_58() {
		Logger.start(true, "为继承代理商和其客服生成二维码");
		try {
			
			// 创建一个渠道商，一个代理商，一个客服
			UserCreateBean usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_channl = DGUserCallService.UserCreateCall(usercreateBean1);
			usercreateBean1 = DGUserCallService.initUsercreateBean();
			int userId_agent = DGUserCallService.UserCreateCall(usercreateBean1);
			// 设置渠道商
			createmchBean createmchbean = GodmchManageCallService.InitcreatemchBeanForChannel(userId_channl);
			GodmchManageCallService.createmchCallForChannel(createmchbean);
			// 渠道商创建一个邀请码，出来一个自动继承的代理商、自动继承渠道商刚才的商品
			CreateCodeBean createbean = GodmchManageCallService.InitcreateCodeBeanForAgent(userId_channl);
			createbean.setAgentModel(2);// 自动继承
			CreateCodeCall CreateCodeCall = GodmchManageCallService.createCodeCall(createbean);
			List<createmchBean> createmchList = GodmchManageCallService.InitcreatemchBeanForAgent(userId_channl,
					userId_agent); //
			createmchList.get(0).setCode(CreateCodeCall.getCode());
			GodmchManageCallService
					.createmchCallForAgent(createmchList.toArray(new createmchBean[createmchList.size()]));
			Thread.sleep(5000);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,
					usercreateBean1.getNickname(), true);
			// 提交发布商品
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().getAsJsonObject("data").get("newProductId")
					.getAsString();
			Thread.sleep(5000);
			LoadPicsBean loadpicsBean = new LoadPicsBean();
			loadpicsBean.setProductId(productId);
			loadpicsBean.setUserId(userId_channl);
			LoadPicsCall loadpicsCall = new LoadPicsCall();
			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			JsonObject jsonObject = loadpicsCall.getJsonObject();
			JsonArray asJsonArray = jsonObject.getAsJsonObject("data").getAsJsonArray("pics");

			loadpicsBean.setUserId(userId_agent);
			loadpicsCall.setData(loadpicsBean);
			loadpicsCall.callService();
			JsonObject jsonObject1 = loadpicsCall.getJsonObject();
			JsonArray asJsonArray1 = jsonObject1.getAsJsonObject("data").getAsJsonArray("pics");

			// 判断客服有没有生成二维码
			Logger.verifyNotEquals(asJsonArray1.get(3), asJsonArray.get(3), "生成了，并且生成的码不一样");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_59() {
		Logger.start(true, "发布商品增加虚拟库存");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(500);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("操作成功", addagentproductCall.getString("message"), "验证message");
			// 判断code
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			// 获取到发布商品的商品id
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_60() {
		Logger.start(true, "添加商品增加虚拟库存,虚拟库存小于0，失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setVirtualStock(-30);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			// 判断code
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			// //获取到发布商品的商品id
			// String productId =
			// addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId").getAsString();
			// Thread.sleep(2000);
			// AgentProductCallService.checkAddAgentProduct(productId,addAgentProductBean,false);
			// verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_61() {
		Logger.start(true, "添加商品单价大于一万元，风控，发布失败");
		try {

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setDirectPrice(10001.00);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyIsContains("单价超过限额", addagentproductCall.getString("message"), "验证message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_62() {
		Logger.start(true, "发布商品增加市场价，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			addAgentProductBean.getCatalogList().get(0).setMarketAmount(100.00);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_63() {
		Logger.start(true, "发布商品，不允许sku重复，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			String sku = addAgentProductBean.getCatalogList().get(0).getSku();
			addAgentProductBean.getCatalogList().get(1).setSku(sku);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_64() {
		Logger.start(true, "根据渠道商的国际属性，判断是否境内商品，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_65() {
		Logger.start(true, "境内渠道商发布商品，判断是否境内商品，发布成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(500772053,
					sellerName, false);
			addAgentProductBean.setCurrency("CNY");
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_66() {
		Logger.start(true, "自动导入的时候，勾选自动上架--会mq回调自动导入，然后验证价格，验证打标");
		try {

			// 创建渠道商
			CreateCodeBean createAllMsgSellerMch = GodmchManageCallService.CreateAllMsgSellerMch();
			// 创建渠道商邀请码
			CreateCodeCall createCodeCall2 = GodmchManageCallService.createCodeCall(createAllMsgSellerMch);
			// 创建代理商
			Integer agentUserId = GodmchManageCallService.CreateSellerMch(
					createCodeCall2.getJsonObject().getAsJsonObject("result").get("code").getAsString());
			int rootUserId = createAllMsgSellerMch.getMchId();

			SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(agentUserId,
					Arrays.asList(rootUserId));
			bean.setMarkupType(3);
			bean.setPercentage(new BigDecimal(0.00));
			bean.setDecimalType(0);
			bean.setOnSaleType(1);
			bean.setRefreshProduct(false);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
			
			
			//验证mq
			MessageListBean MessageListBean = MqQueryCallService.initImportAgentproduct(productId, agentUserId);
            List <Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
            if(joa.size()==0){
                    Thread.sleep(5000);
                     joa = MqQueryCallService.GetMqMessage(MessageListBean);
            }
            joa.forEach(ele->{
                    Logger.debug(ele.toString());
            });
            Logger.verifyEquals(joa.size(), 1, "验证消息总线"+MessageListBean.toString());
            
            
            //验证价格
            List<ProductListDto> getProductLists2 = AddAgentProductCallService.GetProductLists(agentUserId);
			ProductListDto agentProd = getProductLists2.get(0);
			double agentprice = agentProd.getCatalogList().get(0).getAgentPrice();
			// 代理价*1.33=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice * 1.33)).intValue(),
					new Double(agentProd.getCatalogList().get(0).getDirectPrice()).intValue(), "");
			
			//商品打标
			Logger.verifyEquals(agentProd.getAutoMarkupStatus(),1,"已经被打上自动加价的标");
			
			System.out.println(productId+"--"+agentProd.getProductId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_67() {
		Logger.start(true, "自动导入的时候，没有勾选自动上架--mq不会去回调自动导入");
		try {

			// 创建渠道商
			CreateCodeBean createAllMsgSellerMch = GodmchManageCallService.CreateAllMsgSellerMch();
			// 创建渠道商邀请码
			CreateCodeCall createCodeCall2 = GodmchManageCallService.createCodeCall(createAllMsgSellerMch);
			// 创建代理商
			Integer agentUserId = GodmchManageCallService.CreateSellerMch(
					createCodeCall2.getJsonObject().getAsJsonObject("result").get("code").getAsString());
			int rootUserId = createAllMsgSellerMch.getMchId();

			SetMarkupConfigBean bean = GodmchManageCallService.initSetMarketupBean(agentUserId,
					Arrays.asList(rootUserId));
			bean.setOnSaleType(2);
			SetMarkupConfigCall call = GodmchManageCallService.SetMarketupBeanCall(bean);

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
			
			//验证mq
			MessageListBean MessageListBean = MqQueryCallService.initImportAgentproduct(productId, rootUserId);
            List <Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
            if(joa.size()==0){
                    Thread.sleep(5000);
                     joa = MqQueryCallService.GetMqMessage(MessageListBean);
            }
            Logger.verifyEquals(joa.size(), 0, "没有回调总线消息");
            
            //不会自动导入
            List<ProductListDto> getProductLists2 = AddAgentProductCallService.GetProductLists(agentUserId);
			Logger.verifyEquals(getProductLists2.size(),0,"没有自动导入");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_68() {
		Logger.start(true, "saleType不传，如果有规格有物流就是上架");
		try {
			
			// 创建渠道商
			CreateCodeBean createAllMsgSellerMch = GodmchManageCallService.CreateAllMsgSellerMch();
			int rootUserId = createAllMsgSellerMch.getMchId();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setSaleType(null);
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(0, agentProductPo.getInfoProgress(), "验证InfoProgress");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_69() {
		Logger.start(true, "saleType不传，如果有规格没有物流就是下架");
		try {
			// 创建渠道商
			CreateCodeBean createAllMsgSellerMch = GodmchManageCallService.CreateAllMsgSellerMch();
			int rootUserId = createAllMsgSellerMch.getMchId();
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setSaleType(null);
			addAgentProductBean.setCatalogStatus(null);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(-1, agentProductPo.getInfoProgress(), "验证InfoProgress");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_70() {
		Logger.start(true, "发布支持快递配送，支持自提，最小起购为5的商品");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setMinOrderNum(5);
			
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(5, agentProductPo.getMinOrderNum(), "验证最小起购");
			Logger.verifyEquals(true, agentProductPo.getExpressDelivery(), "验证快递");
			Logger.verifyEquals(true, agentProductPo.getCollectionGoods(), "验证自提");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_71() {
		Logger.start(true, "发布不支持自提，不支持快递的商品。发布不成功");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			
			// 创建渠道商
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setCollectionGoods(false);
			addAgentProductBean.setExpressDelivery(false);
//			addAgentProductBean.setMinOrderNum(5);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("请至少选择一种配送方式", addagentproductCall.getString("message"), "验证message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_72() {
		Logger.start(true, "发布仅支持自提，的商品");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setExpressDelivery(false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(false, agentProductPo.getExpressDelivery(), "验证快递");
			Logger.verifyEquals(true, agentProductPo.getCollectionGoods(), "验证自提");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_73() {
		Logger.start(true, "发布仅支持快递，的商品");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			
			// 创建渠道商
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setCollectionGoods(false);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(true, agentProductPo.getExpressDelivery(), "验证快递");
			Logger.verifyEquals(false, agentProductPo.getCollectionGoods(), "验证自提");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_74() {
		Logger.start(true, "发布支持快递，自提为空的商,数据库默认关闭");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setCollectionGoods(null);
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(true, agentProductPo.getExpressDelivery(), "验证快递");
			Logger.verifyEquals(false, agentProductPo.getCollectionGoods(), "验证自提");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_75() {
		Logger.start(true, "商户仅支持快递，发布支持快递与自提的商品");
		try {
			int rootUserId=AgentUsers.vipRootUserId;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setCollectionGoods(true);
			addAgentProductBean.setExpressDelivery(true);
			
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			AgentProductPo agentProductPo = ymtProductsIWapper.selectAgentProductByProductId(productId);
			Logger.verifyEquals(true, agentProductPo.getExpressDelivery(), "验证快递");
			Logger.verifyEquals(false, agentProductPo.getCollectionGoods(), "验证自提");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_76() {
		Logger.start(true, "vip渠道商发布商品，一级一级的继承下去");
		try {
			int vipRootUserId=500781768;
			int vipAgentUserId=500781769;
			int vipAgentUserId1=500781770;

			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					"",true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();

			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
			
			//验证以及代理 mq5
			MessageListBean MessageListBean = MqQueryCallService.initImportAgentproduct(productId, vipAgentUserId);
            List <Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
            if(joa.size()==0){
                    Thread.sleep(5000);
                     joa = MqQueryCallService.GetMqMessage(MessageListBean);
            }
            joa.forEach(ele->{
                    Logger.debug(ele.toString());
            });
            Logger.verifyEquals(joa.size(), 1, "验证消息总线"+MessageListBean.toString());
            
            //验证价格
            List<ProductListDto> getProductLists2 = AddAgentProductCallService.GetProductLists(vipAgentUserId);
			ProductListDto agentProd = getProductLists2.get(0);
			double agentprice = agentProd.getCatalogList().get(0).getAgentPrice();
			// 代理价*1.33=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice * 1.1)).intValue(),
					new Double(agentProd.getCatalogList().get(0).getDirectPrice()).intValue(), "验证一级代理价格");
			
			//商品打标
			Logger.verifyEquals(agentProd.getAutoMarkupStatus(),1,"已经被打上自动加价的标");
			
			
			//验二级及代理 mq
			MessageListBean MessageListBean1 = MqQueryCallService.initImportAgentproduct(agentProd.getProductId(), vipAgentUserId1);
            List <Map> joa1 = MqQueryCallService.GetMqMessage(MessageListBean);
            if(joa1.size()==0){
                    Thread.sleep(5000);
                     joa1 = MqQueryCallService.GetMqMessage(MessageListBean);
            }
            joa1.forEach(ele->{
                    Logger.debug(ele.toString());
            });
            Logger.verifyEquals(joa1.size(), 1, "验证消息总线"+MessageListBean.toString());
            
            //验证价格
            List<ProductListDto> getProductLists21 = AddAgentProductCallService.GetProductLists(vipAgentUserId1);
			ProductListDto agentProd1 = getProductLists21.get(0);
			double agentprice1 = agentProd1.getCatalogList().get(0).getAgentPrice();
			// 代理价*1.33=直销价
			Logger.verifyEquals(new Long(Math.round(agentprice1 * 1.1)).intValue(),
					new Double(agentProd1.getCatalogList().get(0).getDirectPrice()).intValue(), "验证二级代理价格");
			
			//商品打标
			Logger.verifyEquals(agentProd1.getAutoMarkupStatus(),1,"已经被打上自动加价的标");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_77() {
		Logger.start(true, "渠道商发布商品，增加仓库字段");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
            createDepotBean bean=GodmchManageCallService.createDepot(sellerId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_78() {
		Logger.start(true, "渠道商发布商品，选填代理价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().get(0).getAgentPriceList().get(1).setAgentPrice(0);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			AgentProductCallService.checkAddAgentProduct(productId, addAgentProductBean, false);
			verifyMongoCurMq(productId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_79() {
		Logger.start(true, "渠道商发布商品，增加条形码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			List<YmtCatalogsI> Catalogs = ymtCatalogsIWapper.selectCatalogsByProductId(productId);
			Logger.verifyEquals(Catalogs.get(0).getBarcode(), barCodes.get(0), "验证条码");
			Logger.verifyEquals(Catalogs.get(1).getBarcode(), barCodes.get(1), "验证条码");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_80() {
		Logger.start(true, "渠道商发布商品，条形码不能重复");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123_b123_"+TestDataManager.getRandomNum(10),"A123_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(0));;
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyEquals("商品条码不能重复", addagentproductCall.getString("message"), "验证Code");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_81() {
		Logger.start(true, "渠道商发布商品，增加条形码，条形码仅支持数字，字母，下划线");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			List<String> barCodes = Arrays.asList("A123$_b123_"+TestDataManager.getRandomNum(10),"A12 3_b123_"+TestDataManager.getRandomNum(10));
			addAgentProductBean.getCatalogList().get(0).setBarcode(barCodes.get(0));;
			addAgentProductBean.getCatalogList().get(1).setBarcode(barCodes.get(1));;
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyIsContains("商品条码只能包含数字字母呈下划线", addagentproductCall.getString("message"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_82() {
		Logger.start(true, "渠道商发布商品，同店铺不能发布重复条形码");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			addAgentProductBean.getCatalogList().get(0).setBarcode("A123_b123_87291105264");;
			addAgentProductBean.getCatalogList().get(1).setBarcode("A123_b123_23594185703");;
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("201", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyIsContains("商品条码已存在", addagentproductCall.getString("message"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_83() {
		Logger.start(true, "渠道商发布商品，增加商品参数");
		try {
			Integer sellerId = AgentUsers.paramUserId;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productParam="{'啊啊':'哈哈'}";
			addAgentProductBean.setProductParam(productParam);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(sellerId, productId);
			System.out.println(selectProductDetails);
			Logger.verifyEquals(productParam,selectProductDetails.getProductParam(),  "验证productParam");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_84() {
		Logger.start(true, "渠道商发布商品，下面自动铺货的代理，自动铺货");
		try {
			
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);

            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
            setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
            setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
            
            Thread.sleep(5000);
            
            List<ProductListDto> getProductLists = AddAgentProductCallService.GetProductLists(mchId);
			Logger.verifyEquals(1, getProductLists.size(), "验证上架商品");
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			
			List<ProductCatalogListDto> catalogList = getProductLists1.get(0).getCatalogList();
			Logger.verifyEquals(catalogList.get(0).getAgentPrice(), (""+catalogList.get(0).getDirectPrice()*1.01).split(".")[0], "验证价格是否正确");
			Logger.verifyEquals(catalogList.get(1).getAgentPrice(), (""+catalogList.get(1).getDirectPrice()*1.01).split(".")[0], "验证价格是否正确");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_85() {
		Logger.start(true, "渠道商发布商品，下级导入，然后设置自动铺货的代理，查看价格");
		try {
			
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);

            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
            
			
			setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
			setConditionMarkupConfigBean.setRefreshProduct(true);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            
            
            Thread.sleep(5000);
            List<ProductListDto> getProductLists = AddAgentProductCallService.GetProductLists(mchId);
			Logger.verifyEquals(1, getProductLists.size(), "验证上架商品");
			List<ProductListDto> getProductLists1 = AddAgentProductCallService.GetProductLists(agent_mchId);
			Logger.verifyEquals(1, getProductLists1.size(), "验证上架商品");
			List<ProductCatalogListDto> catalogList = getProductLists1.get(0).getCatalogList();
			Logger.verifyEquals(catalogList.get(0).getAgentPrice(), (""+catalogList.get(0).getDirectPrice()*1.01).split(".")[0], "验证价格是否正确");
			Logger.verifyEquals(catalogList.get(1).getAgentPrice(), (""+catalogList.get(1).getDirectPrice()*1.01).split(".")[0], "验证价格是否正确");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_86() {
		Logger.start(true, "添加商品，prarm不能大于1000");
		try {
			
			Integer sellerId = AgentUsers.paramUserId;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String productParam="{'啊啊':'"+TestDataManager.randomStr(1000)+"'}";
			addAgentProductBean.setProductParam(productParam);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("400", addagentproductCall.getString("code"), "验证Code");
			Logger.verifyIsContains("超过限制1000个字符", addagentproductCall.getString("message"), "验证Code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_87() {
		Logger.start(true, "发布商品，新增商品副标题，销售区域，自提点Id，7天无理由退货");
		try {
			Integer sellerId = GodmchManageCallService.CreateGodMch();
			CreateCollectionGoodsAddressBean initCreateCollectionGoodsAddressBean = GodfreightmgrService.initCreateCollectionGoodsAddressBean(sellerId);
			int createcoll = GodfreightmgrService.createcollectiongoodsaddressCall(initCreateCollectionGoodsAddressBean);
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			String subtitle="副标题"+TestDataManager.randomStr(10);
			addAgentProductBean.setSubTitle(subtitle);
			addAgentProductBean.setSaleArea(3);
			addAgentProductBean.setCollectionGoodsAddress(Arrays.asList(createcoll));
			addAgentProductBean.setNoReasonReturn(true);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			AgentProductPo agentProductPo =  new YmtProductsIWapper().selectAgentProductByProductId(productId);
			
			Logger.verifyEquals(subtitle, agentProductPo.getSubTitle(), "验证SubTitle");
			Logger.verifyEquals(3, agentProductPo.getSaleArea(), "验证SaleArea");
			Logger.verifyEquals(createcoll+"", agentProductPo.getCollectionGoodsAddress(), "验证CollectionGoods");
			Logger.verifyEquals(true, ymtProductsI.getbNoReasonReturn(), "验证NoReasonReturn");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_88() {
		Logger.start(true, "创建组合商品，一个规格下--包着有两个单规格商品");
		try {
			//单规格子商品1
			AddAgentProductBean Product1 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product1.getCatalogList().remove(0);
			String productId1 = AddAgentProductCallService.AddAgentProduct(Product1);
//			单规格子商品2
			AddAgentProductBean Product2 = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
			Product2.getCatalogList().remove(0);
			String productId2 = AddAgentProductCallService.AddAgentProduct(Product2);
			
//			套装商品
			AddAgentProductBean addAgentProductBean=AddAgentProductCallService.initAddAgentProduct(sellerId,sellerName, true);
			
			addAgentProductBean.getCatalogList().remove(1);
			SubCatalogDto subCatalogDto = new SubCatalogDto();
			subCatalogDto.setSkuId(Product1.getCatalogList().get(0).getSku());
			subCatalogDto.setBarcode(Product1.getCatalogList().get(0).getBarcode());
			subCatalogDto.setSalePrice(Product1.getCatalogList().get(0).getDirectPrice());
			subCatalogDto.setNum(10);
			
			SubCatalogDto subCatalogDto1 = new SubCatalogDto();
			subCatalogDto1.setSkuId(Product2.getCatalogList().get(0).getSku());
			subCatalogDto1.setBarcode(Product2.getCatalogList().get(0).getBarcode());
			subCatalogDto1.setSalePrice(Product2.getCatalogList().get(0).getDirectPrice());
			subCatalogDto1.setNum(10);
			
			addAgentProductBean.setSubCatalogs(Arrays.asList(subCatalogDto,subCatalogDto1));
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_AddAgentProduct_89() {
		Logger.start(true, "发布旅游商品商品。类目为酒店旅行，物流方式是虚拟");
		try {
			
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, true);
//			addAgentProductBean.setCategoryId(2661);
			
			addAgentProductBean.setThirdCategoryId(2662);
			addagentproductCall.setData(addAgentProductBean);
			addagentproductCall.callService();
			Logger.verifyEquals("200", addagentproductCall.getString("code"), "验证Code");
			String productId = addagentproductCall.getJsonObject().get("data").getAsJsonObject().get("newProductId")
					.getAsString();
			
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productId).get(0);
			Logger.verifyEquals(8, ymtProductsI.getiCatalogStatus(), "物流方式改为了虚拟");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	
	
}